<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>prop方法练习</title>
    <script src="./js/jquery-1.12.4.js"></script>
    <script>
        $(function(){
        // 1.设置按钮的单击事件
        var b = document.getElementsByTagName('button')[0];
        b.onclick = function(){
        // 2.获取输入框的内容
            var input = document.getElementsByTagName('input')[0];
            var text = input.value
        // 3.为img设置新的地址
            $('img').attr('src',text)
        } 
        })

    </script>
</head>
<body>
    <input type="text">
    <button>按钮</button>
    <img src="https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png" alt="">
</body>
</html>